﻿<UserControl x:Class="dotNails.UI.DatabaseList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dotNails="clr-namespace:dotNails.UI"
    Width="526" Height="314">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Styles.xaml"/>
                <ResourceDictionary Source="VectorIcons.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="45"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Border Style="{StaticResource HeaderBorder}">
                <TextBlock Text="Database List" Style="{StaticResource H1}"  />
            </Border>
        </Grid>

        <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
            <ItemsControl x:Name="Databases" Style="{StaticResource Databases}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Border Style="{StaticResource ContentBorder}" Margin="0 0 0 8">
                            <StackPanel Orientation="Vertical">
                                <!-- Database Name -->
                                <StackPanel Orientation="Horizontal" Margin="0 3 0 5">
                                    <TextBlock Text="{Binding Name}" Style="{StaticResource H2}" />
                                    <TextBlock Text="sample text - info about the database - perhaps number of tables and last updated date" Margin="5" FontSize="14" TextWrapping="Wrap" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Margin="50 0 0 0">
                                    <Button CommandParameter="{Binding Name}" Click="Sync" Style="{StaticResource DbmlActionButton}">
                                        <StackPanel Style="{StaticResource DbmlActionButtonPanel}">
                                            <Image Source="{StaticResource iconSync}" Width="20" Height="20" />
                                            <TextBlock Text="Sync" Style="{StaticResource DbmlAction}" />
                                        </StackPanel>
                                    </Button>
                                    <Button CommandParameter="{Binding Name}" Click="Add" Style="{StaticResource DbmlActionButton}">
                                        <StackPanel Style="{StaticResource DbmlActionButtonPanel}">
                                            <Image Source="{StaticResource iconAdd}" Width="20" Height="20" />
                                            <TextBlock Text="Add" Style="{StaticResource DbmlAction}" />
                                        </StackPanel>
                                    </Button>
                                    <Button CommandParameter="{Binding Name}" Click="Remove" Style="{StaticResource DbmlActionButton}">
                                        <StackPanel Style="{StaticResource DbmlActionButtonPanel}">
                                            <Image Source="{StaticResource iconDelete}" Width="20" Height="20" />
                                            <TextBlock Text="Remove" Style="{StaticResource DbmlAction}" />
                                        </StackPanel>
                                    </Button>
                                </StackPanel>
                            </StackPanel>
                        </Border>

                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>

        <dotNails:ConnectionStringManager x:Name="ConnectionStringDialog" Visibility="Hidden" Grid.RowSpan="2" />
        
    </Grid>
    
</UserControl>
